home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_actor_aifists.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  141 lines

  1. # ===================================================================
  2. # Jones 3D Cog Script
  3. #
  4. # actor_AIFists.cog
  5. #
  6. # [RandyT]
  7. #
  8. # Actor script for any AI with just fists...
  9. #
  10. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        created
  16. message        damaged
  17. message        killed
  18. message        timer
  19.  
  20. # ************************** TEMPLATES *************************
  21. template    tplFire=+bazooka_exp_fire    local
  22. template    tplSmoke=+bazooka_exp_smoke    local
  23. template    tplSparks=lavadeathsparks    local
  24.     
  25. # ************************** WEAPON HANDLERS *******************
  26. int            weaponNum=19                local
  27. int            damageType                    local
  28.  
  29. # ************************** AI VARS ***************************
  30. int            TIMER_ID_WAKEUP_NORMAL=0    local
  31. int            TIMER_ID_WAKEUP_AND_DIE=1    local
  32.  
  33. # ************************** MISC LOCAL VARS *******************
  34. int            timerID                        local
  35. int            index                        local
  36. thing        bandito                        local
  37.  
  38. end
  39.  
  40. # ===================================================================
  41. code
  42.  
  43. # -------------------------------------------------------------------
  44. created:
  45.  
  46.     bandito = GetSenderRef();
  47.  
  48.     SetThingFireOffset(bandito, '0.0 0.0 0.0');
  49.     SelectWeapon(bandito, weaponNum);
  50.  
  51.     AIEnableInstinct(bandito, "roam", 0);
  52.  
  53.     return;
  54.  
  55.  
  56. # -------------------------------------------------------------------
  57. damaged:
  58.  
  59.     bandito = GetSenderRef();
  60.     damageType = GetParam(1);
  61.  
  62.     # Been punched?
  63.     if (damageType == 0x08)
  64.     {
  65.         if ((GetParam(0) < GetThingHealth(bandito)) && (GetParam(0) * 2) > GetThingHealth(bandito))
  66.         {
  67.             # Make sure thing's not already disabled
  68.             if (BitTest(GetActorFlags(bandito), 0x40008)) return;
  69.             
  70.             # Play dead
  71.             AIKnockOut(bandito, RandBetween(10, 30), TIMER_ID_WAKEUP_NORMAL);
  72.         }
  73.     }
  74.  
  75.     # Jeep or MineCar hit us
  76.     else if (damageType == 0x02000000)
  77.     {
  78.         # If invulnerable or immobile, ignore -- avoids multiple collision problem
  79.         if (BitTest(GetActorFlags(bandito), 0x40008))
  80.         { 
  81.             ReturnEx(0);
  82.             return;
  83.         }
  84.         else if (GetParam(0) >= GetThingHealth(bandito))
  85.         {
  86.             AIRunOver(bandito, RandBetween(5, 6), TIMER_ID_WAKEUP_AND_DIE);
  87.             ReturnEx(0);
  88.             return;
  89.         }
  90.     }
  91.  
  92.     return;
  93.  
  94.  
  95. # -------------------------------------------------------------------
  96. killed:
  97.  
  98.     bandito = GetSenderRef();
  99.  
  100.     # Killed by lava?
  101.     if (GetParam(1) == 0x200)
  102.     {
  103.         Sleep(0.1);
  104.         CreateThing(tplFire, bandito);
  105.         Sleep(0.3);
  106.         CreateThing(tplSmoke, bandito);
  107.         SetThingFlags(bandito, 0x80000);
  108.  
  109.         for (index = 0; index < 10; index = index + 1)
  110.         {
  111.             CreateThing(tplSparks, bandito);
  112.             Sleep(0.03);
  113.         }
  114.     }
  115.  
  116.     return;
  117.  
  118.  
  119. # -------------------------------------------------------------------
  120. timer:
  121.  
  122.     bandito = GetParam(0);
  123.     timerID = GetSenderId();
  124.  
  125.     if (timerID == TIMER_ID_WAKEUP_NORMAL)
  126.     {
  127.         # Knocked out but not killed
  128.         AIKnockOut(bandito, 0, TIMER_ID_WAKEUP_NORMAL);
  129.         SetHealth(bandito, 100.0);
  130.     }
  131.     else if (timerID == TIMER_ID_WAKEUP_AND_DIE)
  132.     {
  133.         # Make sure not invulnerable
  134.         ClearActorFlags(bandito, 0x8);
  135.         DamageThing(bandito, GetThingMaxHealth(bandito), 0x1, GetLocalPlayerThing());
  136.     }
  137.  
  138.     return;
  139.  
  140. end
  141.